# include<cstdio>
#define MAX 1000

void splid(int& left,int& right,int s[], int length) {
	int mid = length / 2;
	for (left = 0; left <= mid; left++)
	{
		if (s[left] == s[mid])
		{
			break;
		}
	}
	for (right = left+1; right < length; right++)
	{
		if (s[right] != s[mid])
		{
			break;
		}
	}
}
void findMaxCnt(int& mid, int& MaxCnt, int s[], int length) {

	int left, right;
	splid(left, right, s, length);
	int num = length / 2;
	int cnt = right - left;

	if (cnt > MaxCnt)
	{
		MaxCnt = cnt;
		mid = s[num];
	}
	if (left+1 > MaxCnt)
	{
		findMaxCnt(mid, MaxCnt, s, left + 1);
	}
	if (length - right > MaxCnt)
	{
		findMaxCnt(mid, MaxCnt, s + right, length - right);
	}

}
int main() {
	int n, s[MAX];
	int MaxCnt = 0, num = 0;//分别定义重数，众数
	scanf("%d",&n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d",&s[i]);
	}
	findMaxCnt(num, MaxCnt, s, n);
	printf("%d\n%d",num,MaxCnt);
	return 0;
}